<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>买入股票</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
	<div th:include="fragment/navigation-bar :: bar" ></div>

    <div style="margin-top:10px">买入</div>
	<form th:attr="action=@{/hold/new}">
		<fieldset style="border:0">
			代码: <input type="text" name="code" />
			日期: <input type="text" name="date" />
			<input type="submit" value="提交" />
		</fieldset>
	</form>

    <div>持有的股票</div>
	<table border="1" style="text-align: right">
		<tr>
			<td style="width: 66px">名称</td>
			<td>代码</td>
			<td>买入时间</td>
			<td>收益</td>
			<td>趋势操作</td><!--根据趋势，判断买入、卖出时机-->
			<td>当前价格</td>
			<td>买入价格</td>
			<td>卖出价格</td>
			<td>估值操作</td><!--根据估值，判断买入、卖出时机-->
			<td>操作</td>
		</tr>
		<tr th:each="stockData : ${stockMap.values()}">
			<td><a th:text="${stockData.name}"
				th:href="@{/stock/main-finance(code=${stockData.code},pe-start-date=20130101)}"></a></td>
			<td th:text="${stockData.code}"></td>
			<td th:text="${stockData.date}"></td>
			<td th:text="${stockData.profit + '%'}"></td>
			<td style="color:red" th:if="${stockData.action=='卖出'}" th:text="${stockData.action}"></td>
			<td style="color:green" th:if="${stockData.action=='买入'}" th:text="${stockData.action}"></td>
			<td th:if="${stockData.action=='持有'}" th:text="${stockData.action}"></td>
			<td th:text="${stockData.price}"></td>
			<td th:text="${stockData.buyPrice}"></td>
			<td th:text="${stockData.sellPrice}"></td>
			<td th:style="'color:' + ( (${stockData.peAction}=='卖出')?'red':((${stockData.peAction}=='买入')?'green':'black'))" th:text="${stockData.peAction}"></td>
			<td><a th:href="@{/hold/set-price(code=${stockData.code},buyPrice=,sellPrice=)}">设置</a></td>
		</tr>
	</table>
</body>
</html>